import book.BookList;
import user.Admit;
import user.NormalUser;
import user.User;

import java.util.Scanner;

public class Main {

    public static User login() {
        System.out.println("欢迎来到图书管理系统");
        System.out.print("请输入你的名字:");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("请选择你的身份  1-管理员  2-用户");
        int choice = scanner.nextInt();
        if(choice == 1) {
            return new Admit(name);
        }else {
            return  new NormalUser(name);
        }
    }


    public static void main(String[] args) {
        //创建一个书架
        BookList bookList = new BookList();
        //登录功能
        User user = login();
        while(true) {
            int choice = user.menu();
            user.electFunc(choice,bookList);
        }

    }

}
